home *** CD-ROM | disk | FTP | other *** search
/ Art Works / Art Works.iso / apps / _installer / _runimage (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1996-03-26  |  28.5 KB  |  1,263 lines

  1.  > <installer$dir>.!RunImage
  2. =&18000
  3. FREE%=
  4. DEBUG%=
  5. grab_memory(0)
  6. Block2%=
  7. claim(256)
  8. package$="ArtWorks"
  9. *resource$="<installer$dir>.Resources."
  10.     !flatfile$=resource$+"massive"
  11. channel%=
  12. userName$=""
  13. userAddress$=""
  14.  "XHourglass_Smash":!Block2%=
  15. message(
  16. ,"Internal error "+
  17. $+" "+
  18. +"."+
  19. ),2):
  20.  "Wimp_Initialise",200,&4B534154,package$+" Installer" 
  21.  ,task%
  22.  "StreamSquash_Initialise",package$+" Installer"
  23.  "StreamSquash_InfoDecompress",,1 
  24.  LZW_Needs%
  25. Frame%=0
  26. DRAG=2
  27. GREY=1
  28. NONE=-2
  29. System_Page%=9
  30. Source_Page%=&12
  31. Dest_Page%=&11
  32. Between_Page%=&13
  33. Disc2_Page%=&14
  34. GetNamePage%=&15
  35. continue%=0
  36. help%=1
  37. goback%=2
  38. stop%=3
  39. get_mode_info
  40. report("Yeig: "+
  41. yeig%)
  42. Indirect_Size%=1024
  43. "2Script_Size% = 
  44. _FileSize(resource$+"!script")
  45. #.Massive% = 
  46. _FileSize(resource$+"massive")
  47.  Massive% = 
  48.  0,"There is no ""massive"" file within this installer":
  49. SystSize%=32*1024
  50. &ETemplate_Size% = (255 + 
  51. _FileSize(resource$+"templates")) 
  52. '3Button_Size%  = 
  53. _FileSize(resource$+"buttons")
  54. Announce_Size%=64*1204
  55. )+Sprite_Len%=Announce_Size%+Button_Size%
  56.  Window%(8)
  57. +$Template%=
  58. claim(Template_Size%)
  59. ,$Indirect%=
  60. claim(Indirect_Size%)
  61. - Script%=
  62. claim(Script_Size%)
  63. Routes%=
  64. claim(32)
  65. Block%=
  66. claim(4)
  67. Block4%=
  68. claim(1020)
  69. black%=
  70. claim(32)
  71. PixelT%=
  72. claim(16)
  73. ScaleT%=
  74. claim(16)
  75. 4DAnnounce$=resource$+"asq"+
  76.  yeig%<4,"20")+
  77.  yeig%>=4,"12")
  78. 5(Application$=
  79. sysvar("ArtWorks$Dir")
  80. System$=
  81. getsystempath
  82. 7$Source$=
  83. sysvar("Installer$Dir")
  84. report("Source: "+Source$)
  85. 9,Reason$="(You clicked the Stop button)."
  86. setsources
  87. NoWimpPoll%=
  88. width%=0
  89. height%=0
  90. Flags%=
  91. IconHandle%=
  92. ToFloppy%=
  93. Swapping%=
  94. Installed%=
  95. Announced%=
  96. Claimed%=
  97. Percentage%=0
  98. FloppySize%=0
  99. BigFloppy%=&C8000
  100. H8SpritePool%=
  101. claim(Button_Size%+Announce_Size%+1024)
  102.  "XStreamSquash_FlatFileOpenIn",SpritePool%,,flatfile$ 
  103.  ,FlatMin%,FlatMax%
  104. J9Work_Area%=
  105. claim(
  106. bigger(FlatMin%-Announce_Size%,0))
  107. Pages%=
  108. _Load_Script
  109. Current_Page%=0
  110. Current_RPtr%=Routes%
  111. Return_Page%=
  112. _sprites
  113. poll_mask%=1 
  114.  1<<4 
  115.  1<<5
  116. clicked%=0
  117. clickicon%=0
  118. Frames%=
  119. _templates
  120. Last%=Frames%-1
  121.  "Wimp_Poll",poll_mask%,Block% 
  122.  reason%
  123.  reason% 
  124. handle_redraw
  125. OpenWindow
  126. decode_drag
  127. click%=Block%!8
  128. icon%=Block%!16
  129.  icon%>=0 
  130.  icon%<6 
  131.  (click%=4 
  132.  click%=1) 
  133. icon%=
  134. _clicked(icon%):Current_Page%=
  135. _Page(Current_Page%,icon%)
  136.  icon%=8 
  137.  click%=&40 
  138. drag_it(Block%!0,Block%!4)
  139. 17,18:
  140. receive(Block%!16)
  141.  (reason%=17 
  142.  reason%=18) 
  143.  Block%!16=0
  144. _clicked(button%)
  145. _IconState(Current_Page%,button% 
  146.  255,
  147.  button% 
  148.  256 
  149. >T%+15
  150. -12):
  151. _IconState(Current_Page%,button% 
  152.  255,
  153. =button%
  154. _IconState(p%,i%,s%) 
  155. p%=Routes%-(p%<<4)
  156. w%=Window%((p%?&D)
  157.  w%=0 
  158.  notext%
  159. notext%=3
  160. black%!0 = w%
  161. black%!4 = i% 
  162.  s%=DRAG 
  163. black%!8 =  10<<12
  164. black%!12 = 15<<12
  165.  s%=GREY 
  166. }.black%!8 = 2<<24 
  167.  0<<12 
  168.  1<<28 
  169.  notext%
  170. ~9black%!12= 15<<24 
  171.  1<<21 
  172.  15<<12 
  173.  15<<28 
  174.  notext%
  175.  s%=NONE 
  176. black%!8 = 0
  177. black%!12= notext% 
  178.  15<<12
  179. Vblack%!8 = (1<<21 
  180.  s%) 
  181.  3<<12 
  182.  (1<<28 
  183.  s%=0) 
  184.  (14<<28 
  185.  s%) 
  186.  7<<24 
  187.  notext%
  188. Bblack%!12= 1<<21 
  189.  15<<12 
  190.  15<<12 
  191.  15<<28 
  192.  15<<24 
  193.  notext%
  194.  "Wimp_SetIconState",,black%
  195. _GetIconString(win%,icon%)
  196.  data%
  197. win%=Routes%-(win%<<4)
  198. win%=Window%((win%?&D)
  199.  win%=0 
  200. Block%!0 = win%
  201. Block%!4 = icon%
  202.  "Wimp_GetIconState",,Block%
  203. data% = !(Block%+28)
  204. len% = (!(Block%+36))-1
  205. rtoz1(data%,len%)
  206. _Page(this_page%,button%)
  207.  next_page%, next_frame%, route_ptr%, button_type%, action%
  208. *route_ptr% = Routes% - (this_page%<<4)
  209. button%=button% 
  210. 'next_page% = route_ptr%?(button%+4)
  211.  next_page% 
  212.  &E0 
  213. next_page%=
  214. action(this_page%,next_page%)
  215.  next_page%<0 
  216.  next_page%>=Pages% 
  217.  0,"Bad route in script file"
  218. *route_ptr% = Routes% - (next_page%<<4)
  219. 'next_frame% = (route_ptr%?&D) 
  220.  next_page%<>this_page% 
  221. !Block%=Window%(Frame%)
  222.  "Wimp_CloseWindow",,Block%
  223. _IconState(next_page%,8,NONE)
  224.  button%=0 
  225. 'button_type%=route_ptr%?(button%+4)
  226.   button_type%=next_page% 
  227.  Announced% 
  228.  ((button_type% 
  229.  &40)=next_page%) :action%=GREY
  230.   button_type%=&80            :action%=NONE
  231.   button_type%=&81            :action%=
  232. _IconState(next_page%,8,DRAG)
  233.  :action%=
  234. _IconState(next_page%,button%,action%)
  235. _open(next_frame%,Frame%)
  236. Return_Page%=this_page%
  237. Frame%=next_frame%
  238.  next_page% = GetNamePage% 
  239.  "Wimp_SetCaretPosition",Window%(Frame%),9,0,0,-1,0
  240. =next_page%
  241. action(from%,command%)
  242.  result%
  243. result%=
  244.  command%
  245.  &20 :
  246.  Installed%=
  247.  (command% 
  248.  &1F)=0 
  249. pop_up:
  250.  &40 :
  251.  from% 
  252. free_announce
  253.  Announced%=0 
  254. result%=0
  255.  Application$="" 
  256.  System$="" 
  257. result%=&F
  258.  &15 :userName$ = 
  259. _GetIconString(from%,9)
  260. &userName$ = 
  261. tidyString(userName$)
  262. ,userAddress$ = 
  263. _GetIconString(from%,10)
  264. ,userAddress$ = 
  265. tidyString(userAddress$)
  266. (userName$) < 2 
  267. (userAddress$) < 2 
  268. result% = GetNamePage%
  269.  &60 :Installed%=
  270. floppy:
  271.  "Hourglass_Off"
  272.  Installed%<>
  273. Percentage%=0:
  274. update_bar:result%=from%
  275.  Installed%>0 
  276. result%=Installed%
  277.  &80 :result%=from%
  278.  &A0 :
  279.  "Wimp_SlotSize",&8000+
  280.  "Wimp_StartTask","%run "+Application$
  281.  &C0 :
  282.  "Hourglass_On":Installed%=
  283. unpack(Application$):
  284.  "Hourglass_Off"
  285.  Installed%<>
  286. Percentage%=0:
  287. update_bar:result%=from%
  288.  Installed%>0 
  289. result%=Installed%
  290.  &E0 :result%=Return_Page%:Reason$="(You clicked the Stop button)."
  291.  result%=
  292. result%=command% 
  293. =result%
  294. _templates
  295.  End%,Frame%,Tail$,More%,This%
  296. Tail$=
  297. 12," ")
  298. Next%=Indirect%
  299. !End%=Indirect%+Indirect_Size%
  300. Frame%=0
  301.  "Wimp_OpenTemplate",,resource$+"Templates"
  302.  "Wimp_LoadTemplate",,Template%,Next%,End%,
  303. ,"Info"+Tail$,0 
  304.  ,,Next%,,,More%
  305.  "Wimp_LoadTemplate",,Template%,Next%,End%,
  306. (Frame%)+Tail$,0 
  307.  ,,Next%,,,More%
  308. Template%!64=SpritePool%
  309.  "Wimp_CreateWindow",,Template% 
  310.  Window%(Frame%)
  311. Frame%+=1
  312.  Frame%=3
  313. "!Block%=Window%(0):Block%!4=10
  314.  "Wimp_GetIconState",,Block%
  315. VersionPtr%=Block%!28
  316.  "Wimp_CloseTemplate"
  317. (channel%=
  318. "<installer$dir>.!Version"
  319.  Flags%=0 
  320.  4:Version%=
  321. #channel%,9)):
  322. #channel%:channel%=
  323. ?Version$=
  324. (Version% 
  325.  1000)+"."+
  326. "00"+
  327. (Version% 
  328.  1000),3)
  329. $VersionPtr%=
  330. Version$,5)
  331. _open(0,
  332. _IconState(0,goback%,GREY)
  333. =Frame%
  334. _open(Now%,Then%)
  335.  Then%>
  336. Block%!0  = Window%(Then%)
  337.  "Wimp_GetWindowState",,Block%
  338. (height%=(Template%!12)-(Template%!4)
  339. 'width%= (Template%!8)-(Template%!0)
  340. #Block%!4  = (ScrnX%-width%) 
  341. $Block%!8 =  (ScrnY%-height%) 
  342. "Block%!12 = width% +  Block%!4
  343. "Block%!16 = height% + Block%!8
  344. Block%!20 = 0
  345. Block%!24 = 0
  346. Block%!0  = Window%(Now%)
  347. Block%!28 = 
  348. OpenWindow
  349. OpenWindow
  350.  "Wimp_OpenWindow",,Block%
  351. Yadjust%=Block%!8-Block%!16
  352. pop_up
  353.  Installed%=
  354.  "XOS_CLI","%wimptask %run "+Application$+".!Boot"
  355.  "XOS_CLI","%set alias$open_installed Filer_OpenDir "+
  356. filepath(Application$)
  357.  "XOS_CLI","open_installed"
  358.  "XOS_CLI","%unset alias$open_installed"
  359. SaveUserName(dest$)
  360.  nl$,qu$,out$,f$,l%,Choices%,Top%,Base%
  361. sout$="[ UserInfo_choices"+nl$+"  UserName "+qu$+userName$+qu$+nl$+"  UserAddress "+qu$+userAddress$+qu$+nl$+"]"
  362. f$=dest$+"!Choices"
  363.  out$
  364. Choices% = 
  365. _FileSize(f$)
  366. %ChoiceBuff% = 
  367. claim(Choices%+l%)
  368.  "OS_File",16,f$,ChoiceBuff%
  369. Cptr% = ChoiceBuff%
  370.  Cend% = ChoiceBuff%+Choices%
  371.  (Cptr%<Cend% 
  372.  Cptr%?0=
  373.  Cptr%?1=32 
  374.  Cptr%?2=
  375.     s$=""
  376.  (Cptr%<Cend% 
  377.  (?Cptr%>31))
  378. s$=s$+
  379. ?Cptr%
  380. Cptr%+=1
  381. "f% = (s$="[ UserInfo_choices")
  382. Cptr%+=1
  383. Top%=Cend%
  384. Base%=Cptr%-19
  385. Top%=Cptr%
  386.  (Cptr%<Cend% 
  387. f% = (?Cptr%=
  388. Cptr%+=1
  389. Top%=Cptr%
  390. ScriptLen%=Top%-Base%
  391. diff% = l%-ScriptLen%
  392. shiftbuff(Top%, Top%+diff%, Cend%-Top%)
  393. Cend%+=diff%
  394. pokestr(out$,Base%)
  395. pokestr(nl$+out$+nl$,Top%)
  396. Cend%=Cend%+l%-1
  397.  "OS_File",10,f$,&FFF,,ChoiceBuff%,Cend%
  398. 5 FREE%=
  399. claim(-(Choices%+l%))
  400. shiftbuff(start%,end%,len%)
  401.  len%>0 
  402.  start%>end% 
  403.  l%=0 
  404.  len%-1
  405. end%?l%=start%?l%
  406.  l%=(len%-1) 
  407. end%?l%=start%?l%
  408. pokestr(s$,buff%)
  409. s$>0 
  410.  l%=1 
  411. ?buff%=
  412. s$,l%,1)
  413. buff%+=1
  414.  "XStreamSquash_Exit"
  415.  channel%<>
  416. #channel%
  417.  "XWimp_CloseDown",task%,&4B534154
  418. message(number%,message$,flags%)
  419.  message$<>"" 
  420. !FREE%=number%:$(FREE%+4)=message$+
  421. 0:number%=FREE%
  422.  "Wimp_ReportError",number%,flags%,package$+" Installer" 
  423.  ,flags%
  424. =flags%
  425. _sprites
  426.  File_Size%,Source%
  427. X!Source%=Work_Area%+LZW_Needs%
  428. SpritePool%!0= Sprite_Len%
  429. SpritePool%!8=16
  430.  "OS_SpriteOp",256+9,SpritePool%
  431. \$File_Size%=
  432. _FileSize(Announce$)
  433.  "OS_File",&10,Announce$,Source%
  434.  "StreamSquash_OpenDecompress",Work_Area%,1
  435.  "StreamSquash_DecompressBlock",Work_Area%,Source%,File_Size%,SpritePool%+4,Sprite_Len% 
  436.  ,A%,B%,C%,D%
  437.  "StreamSquash_CloseDecompress",Work_Area%,A%,B%,C%,D% 
  438.  (E% 
  439.  3)<>0 
  440.  0,"AnnounceSq is corrupted."
  441.  "OS_SpriteOp",256+11,SpritePool%,resource$+"buttons"
  442.  fill%=0 
  443.  yeig%
  444.  "OS_SpriteOp",256+32,SpritePool%,"announce",0
  445.  "OS_SpriteOp",256+60,SpritePool%,"announce",1
  446.  "Wimp_SetColour",1
  447.  0,0,10,512
  448.  0,464,966,16
  449.  956,0,966,512
  450.  "OS_SpriteOp",256+60,SpritePool%,
  451. free_announce
  452.  "XOS_SpriteOp",&119,SpritePool%,"announce",1
  453.  "OS_SpriteOp",&108,SpritePool% 
  454.  ,,,,,Sprite_Len%
  455. SpritePool%!0=Sprite_Len%
  456. Announced%=
  457. r!FREE%=
  458. claim(-Announce_Size%)
  459. handle_redraw
  460.  flag%
  461. "Wimp_RedrawWindow",,Block% 
  462.  flag%
  463. redraw_window(!Block%,flag%)
  464. redraw_window(handle%,flag%)
  465.  slab%
  466. {2slab%=(?(Routes%-(Current_Page%<<4)+&D)) 
  467.  flag%<>0
  468.  NoWimpPoll% 
  469.  "Wimp_SetColour",1:
  470.  36+Block%!4,184+Block%!8,width%,height%
  471.  !Block%=handle% 
  472. ridge(32+Block%!4,16+Block%!8,912,72)
  473.  (slab% 
  474.  &80)=0 
  475. ridge(32+Block%!4,108+Block%!8,912,472)
  476.  slab% 
  477.  &10 
  478. slab(64+Block%!4,124+Block%!8,844,48)
  479.  slab% 
  480.  &20 
  481. slab(64+Block%!4,192+Block%!8,168,132)
  482.  slab% 
  483.  &40 
  484. slab(716+Block%!4,172+Block%!8,-656,-44):
  485. draw_bar(76+Block%!4,140+Block%!8,6.20*Percentage%,20)
  486. _Recite(Current_Page%,Block%!4,Block%!8)
  487. "Wimp_GetRectangle",,Block% 
  488.  flag%
  489. update_bar
  490. force_update(76,140,704,164)
  491. flicker(Current_Page%,disc$)
  492.  Swapping% 
  493.  FromCD% 
  494. discname(disc$)<>
  495. whatdisc 
  496. showpage(Current_Page%)
  497. >T%+100
  498. discname(disc$)=
  499. whatdisc
  500. _clicked(256)
  501. _IconState(Current_Page%,0,GREY)
  502. showpage(Between_Page%)
  503. showpage(Current_Page%)
  504. NoWimpPoll%=
  505. force_update(48,100,938,570)
  506. NoWimpPoll%=
  507. force_update(Block%!4,top%,Block%!12,bot%)
  508.  flag%
  509. !Block%=Window%(1)
  510. Block%!8=top%+Yadjust%
  511. Block%!16=bot%+Yadjust%
  512.  "Wimp_UpdateWindow",,Block% 
  513.  flag%
  514. redraw_window(Window%(1),flag%)
  515. draw_bar(x%,y%,w%,h%)
  516.  "Wimp_SetColour",11
  517.  x%,y%,w%,h%
  518.  "Wimp_SetColour",1
  519.  xeig%+x%+w%,y%,630-w%,h%
  520. ridge(x%,y%,w%,h%)
  521.  "Wimp_SetColour",2
  522.  x%,y%,w%,3
  523.  x%,y%-4,3,h%+2
  524.  x%,y%+h%,w%,3
  525.  x%+w%,y%,3,h%+2
  526.  x%+w%+4,y%+h%+2,1,1
  527.  x%+6,y%,1,1
  528.  "Wimp_SetColour",0
  529.  x%+4,y%-4,w%+2,3
  530.  x%+4,y%-4,3,h%
  531.  x%+4,y%+h%-4,w%-6,3
  532.  x%+w%+4,y%,3,h%+2
  533.  x%+w%,y%+h%-2,1,1
  534.  x%+2,y%-4,1,1
  535.  "Wimp_SetColour",2
  536. slab(x%,y%,w%,h%)
  537.  "Wimp_SetColour",4
  538.  x%,y%+h%,w%,3
  539.  x%,y%,3,h%
  540.  "Wimp_SetColour",0
  541.  x%+2,y%,w%-2,3
  542.  x%+w%,y%,3,h%-2
  543. _Recite(Page%,x%,y%)
  544.  lines%,vpos%,textptr%,endptr%,gap%
  545.  "Wimp_SetColour",7
  546. vpos%=560+y%
  547.  DEBUG% 
  548.  4+x%,600+y%:
  549. ;~Page%;" ";
  550. textptr%=Routes%-(Page%<<4)
  551. endptr%=textptr%!-16
  552. gap%=(textptr%?14)*4
  553.  gap%<32 
  554.  gap%>255 
  555. gap%=32
  556. textptr%=!textptr%
  557. lines%=0
  558.  y%<vpos% 
  559.  textptr%<endptr%
  560. $textptr%,1) 
  561.  "\" :vpos%+=gap%
  562.  ">" :
  563.  x%+gap%+224,vpos%:
  564. $textptr%,2);
  565.  "|" :
  566.  (890-16*
  567. ($textptr%))
  568. 2+48+x%,vpos%:
  569. $textptr%,2);
  570.  "$" :
  571.  x%+gap%+32,vpos%:
  572. $textptr%,2)+"$");
  573.  "@" 
  574.  "Wimp_ReadPixTrans",&100,SpritePool%,"artfloppy",,,,ScaleT%,PixelT%
  575.  "OS_SpriteOp",256+52,SpritePool%,
  576. $textptr%,2),x%+gap%+32,vpos%-64,,ScaleT%,PixelT%
  577. vpos%+=gap%
  578.  x%+gap%+32,vpos%:
  579.  ;$textptr%;
  580. vpos%-=gap%
  581. lines%+=1
  582. textptr%+=(
  583. $textptr%)+1
  584. writeln(Page%,Line%,text$)
  585.  pageptr%,textptr%,loop%
  586. pageptr%=Routes%-(Page%<<4)
  587. textptr%=!pageptr%
  588. loop%=Line%
  589.  loop%>0 
  590.  loop%<16
  591. textptr%+=(
  592. $textptr%)+1
  593. loop%-=1
  594.  loop%=0 
  595.  Page%=Current_Page% 
  596.  "Wimp_ForceRedraw",Window%(&F 
  597.  pageptr%?&D),64,128+Yadjust%,64+844,Yadjust%+48+124
  598. _Load_Script
  599.  TextPtr%,RoutePtr%,Pages%,Words%
  600. #channel%=
  601. (resource$+"!script")
  602. Pages%=0
  603. TextPtr%=Script%
  604. RoutePtr%=Routes%
  605. Next$=
  606. #channel%
  607. #channel%
  608. !RoutePtr%=TextPtr%
  609.  Words%=4 
  610. 'RoutePtr%!Words%=
  611. ("&"+
  612. Next$,2,8))
  613. Next$=
  614. #channel%
  615. RoutePtr%-=16
  616. Pages%+=1
  617.  RoutePtr%<=TextPtr% 
  618. ("Badly formed script file")
  619. Next$,1)<>"[" 
  620. $TextPtr%=Next$
  621. TextPtr%+=1+
  622. Next$
  623. Next$=
  624. #channel%
  625. #channel% 
  626. Next$,1)="["
  627. #channel%
  628. channel%=
  629. !RoutePtr%=TextPtr%
  630. =Pages%
  631. drag_it(mx%,my%)
  632.  hnd%
  633. hnd%=Window%(Frame%)
  634. dragIcon%=icon%
  635. 1!Block%=hnd%:
  636.  "Wimp_GetWindowState",,Block%
  637. bx%=Block%!4-Block%!20
  638. by%=Block%!16-Block%!24
  639. >!Block%=hnd%:Block%!4=icon%:
  640.  "Wimp_GetIconState",,Block%
  641. ix0%=Block%!8
  642. iy0%=Block%!12
  643. ix1%=Block%!16
  644. iy1%=Block%!20
  645. !Block%=hnd%
  646. Block%!4=5
  647. Block%!8=bx%+ix0%
  648. Block%!12=by%+iy0%
  649. Block%!16=bx%+ix1%
  650. Block%!20=by%+iy1%
  651. Block%!24=Block%!8-mx%
  652. Block%!28=Block%!12-my%
  653. !"Block%!32=ScrnX%+Block%!16-mx%
  654. ""Block%!36=ScrnY%+Block%!20-my%
  655.  "Wimp_DragBox",,Block%
  656. get_mode_info
  657. Block2%!0=4
  658. Block2%!4=5
  659. Block2%!8=11
  660. Block2%!12=12
  661. Block2%!16=-1
  662.  "OS_ReadVduVariables",Block2%,Block2%+20
  663. xeig%=1<<(Block2%!20)
  664. yeig%=1<<(Block2%!24)
  665. ScrnX%=(Block2%!28+1)*xeig%
  666. ScrnY%=(Block2%!32+1)*yeig%
  667. receive(reason%)
  668.  block%,tail$,name$
  669. block%=Block%
  670.  Current_Page%=System_Page% 
  671. tail$="!System" 
  672. tail$="!"+package$
  673.  reason% 
  674.  block%!36=-1 
  675. 8%name$=
  676. filepath(
  677. rtoz(block%+44))
  678.  name$<>"" 
  679. name$+="."+tail$
  680. block%!16=3
  681. block%!12=block%!8
  682.  "Wimp_SendMessage",17,block%,block%!4
  683.  &400C1 :
  684. get_mode_info
  685.  3 :name$=
  686. rtoz(Block%+44)
  687. Block%!12=Block%!8 
  688. Block%!12=4        
  689.  "Wimp_SendMessage",18,Block%,Block%!4
  690. upper(
  691. filename(name$))<>
  692. upper(tail$) 
  693. name$=""
  694.  name$<>"" 
  695.  Current_Page%=System_Page% 
  696. F&System$=
  697. filepath(name$)+"."+tail$
  698. H+Application$=
  699. filepath(name$)+"."+tail$
  700. writeln(Current_Page%,12,name$+"."+tail$)
  701. filepath(path$)
  702. (path$)
  703.  cc%>0 
  704. path$,cc%,1)<>"."
  705. cc%-=1
  706. path$,0<cc% 
  707.  cc%-1 )
  708. filepath1(path$)
  709. (path$)
  710.  cc%>0 
  711. path$,cc%,1)<>","
  712. cc%-=1
  713.  cc%=0 
  714. path$,
  715. (path$)-cc%)
  716. filename(path$)
  717. (path$)
  718.  cc%>0 
  719. path$,cc%,1)<>"."
  720. cc%-=1
  721. path$,0<cc% 
  722.  cc%+1)
  723. upper(mixed$)
  724.  cc%,alpha%
  725. (mixed$)
  726.  cc%>0
  727. alpha%=
  728. mixed$,cc%,1)
  729.  alpha%>96 
  730.  alpha%<123 
  731. mixed$,cc%,1)=
  732. (alpha% 
  733.  223)
  734. cc%-=1
  735. =mixed$
  736. rtoz(p%)=
  737. rtoz1(p%,255)
  738. rtoz1(p%,l%)
  739. o    q$=""
  740.  (?p%)>31 
  741.  l%>0
  742. q$=q$+
  743. p%+=1:l%-=1
  744. ztor(string$,address%)
  745. $address% = string$
  746. ?(address%+
  747. (string$)) = 0
  748. tidyString(string$)
  749. string$,1) = " "
  750. {$string$ = 
  751. string$,
  752. (string$)-1)
  753. string$,1) = " "
  754. ~$string$ = 
  755. string$,
  756. (string$)-1)
  757. =string$
  758. decode_drag
  759.  "Wimp_GetPointerInfo",,Block%
  760. mx%=!Block%
  761. my%=Block%!4
  762. h%=Block%!12
  763. i%=Block%!16
  764. drag_filepath(h%,i%,mx%,my%,&DDD,-1)
  765. drag_filepath(h%,i%,mx%,my%,ft%,task%)
  766. !Block%=(48+
  767. ("$"))
  768. Block%!12=0
  769. Block%!16=1
  770. Block%!20=h%
  771. Block%!24=i%
  772. Block%!28=mx%
  773. Block%!32=my%
  774. Block%!36=0
  775. Block%!40=ft%
  776. $(Block%+44)="$"
  777. "?(Block%+44+
  778. ($(Block%+44)))=0
  779.  "Wimp_SendMessage",17,Block%,h%,i%
  780. saveref%=Block%!8
  781. floppy
  782.  FloppyName$
  783. FloppyName$=
  784. whatdisc
  785.  FloppyName$="ArtWorks1" 
  786. message(0,"That's the installer disc ... please put in a blank disc",1)
  787.  FloppyName$="" 
  788. write_prot(FloppyName$) 
  789. message(0,"That disc is read-only ... please adjust the write-protect tab",1)
  790.  "XADFS_FreeSpace","0" 
  791.  FloppySize%;flags%
  792.  flags% 
  793. FloppySize%=0:=0
  794.  FloppySize%<&C7000 
  795. _FileSize("adfs::0.$.!ArtWorks")=
  796. message(0,"There isn't enough space on that disc for ArtWorks",1)
  797. 5Application$="ADFS::"+FloppyName$+".$.!"+package$
  798. ToFloppy%=
  799. TSwapping%=ToFloppy% 
  800. upper(
  801. Source$,
  802. ("ADFS::ArtWorks1.")))="ADFS::ARTWORKS1."
  803. report(
  804. upper(
  805. Source$,
  806. ("ADFS::ArtWorks1."))))
  807. report("Swapping "+
  808. ~Swapping%)
  809.  "Hourglass_On"
  810. unpack(Application$)
  811. unpack(dest$)
  812.  Work_Area%,buffer%,read_ptr%,next_ptr%,write_ptr%,name$,path$,start%,rewind%,thruput%,upto%,headroom%
  813.  load%,exec%,size%
  814.  "XOS_Byte",229,1:Reason$=
  815. =17),"(You pressed Escape)")+
  816. <>17),"Reason: "+
  817. $,40)+" at &"+
  818. ~(&8000+(
  819. 10))):=2
  820.  "XOS_Byte",229
  821.  buttons%=1 
  822.  buttons%<>4 
  823. _IconState(Current_Page%,buttons%,GREY)
  824. thruput%=0
  825. 2MaxThruPut%=Massive%+(SystSize% 
  826.  ToFloppy%=
  827.  Claimed%
  828. grab_memory(FlatMax%-FlatMin%)
  829. report(
  830. Claimed%=
  831. #Work_Area% = 
  832. claim(LZW_Needs%)
  833. flicker(Source_Page%,Source$)
  834. #channel%=
  835. (resource$+"massive")
  836.  "XOS_GBPB",4,channel%,FREE%,32
  837. Largest_Src%=FREE%!12
  838. Largest_LZW%=FREE%!8
  839. Largest%=FREE%!4
  840. %Save_Area% = 
  841. claim(Largest_Src%)
  842. buffer%=FREE%
  843. headroom%=Z%
  844. path$=""
  845. read_ptr%=buffer%
  846. flicker(Source_Page%,Source$)
  847. rewind%=
  848. #channel%
  849.  "XOS_GBPB",4,channel%,read_ptr%,32
  850. %next_ptr%=(read_ptr%!4)+read_ptr%
  851. $len%=(read_ptr%!4)-(read_ptr%!8)
  852.  next_ptr%<=headroom% 
  853.  "XOS_GBPB",4,channel%,read_ptr%+32,(read_ptr%!4)-32
  854. thruput%+=len% 
  855. 6Percentage%=100*thruput% 
  856.  MaxThruPut%:
  857. update_bar
  858. read_ptr%=next_ptr%
  859. #channel%=rewind%
  860.  next_ptr%>headroom% 
  861. #channel%
  862. upto%=read_ptr%
  863. #channel% 
  864.  #channel%
  865. channel%=
  866. dest$,1)<>"." 
  867.  "OS_File",16,resource$+"!Run",Save_Area% 
  868.  ,,A%,B%,C%
  869.  "OS_File",16,resource$+"!RunImage",Save_Area%+C% 
  870.  ,,D%,E%,F%
  871.  ToFloppy% 
  872. showpage(Between_Page%)
  873. flicker(Dest_Page%,dest$)
  874.  "OS_CLI","CDIR "+dest$
  875. dest$+="."
  876.  "OS_File",0,dest$+"!Run",A%,B%,Save_Area%,Save_Area%+C%
  877.  "OS_File",0,dest$+"!RunImage",D%,E%,Save_Area%+C%,Save_Area%+C%+F%
  878. write_ptr%=buffer%
  879. flicker(Dest_Page%,dest$)
  880. name$=
  881. rtoz(write_ptr%+32)
  882.  (FloppySize%<BigFloppy% 
  883.  ToFloppy% 
  884.  write_ptr%?29 
  885. report("skipping "+name$)
  886. "start%=write_ptr%+write_ptr%!8
  887. &len%=(write_ptr%!4)-(write_ptr%!8)
  888. thruput%+=(len% 
  889. report("Saving: "+dest$+name$+" "+
  890. ~write_ptr%)
  891. name$=
  892. mkdir(name$,path$)
  893. report("Made directories")
  894. _FileSize(dest$+name$)>
  895.  write_ptr%?29 
  896.  2)=0 
  897.  !write_ptr% 
  898.  &6574614B 
  899.  "StreamSquash_OpenDecompress",Work_Area%,1
  900.  "StreamSquash_DecompressBlock",Work_Area%,start%,len%,Save_Area%,write_ptr%!24 
  901.  ,A%,B%,C%,D%
  902.  "StreamSquash_CloseDecompress",Work_Area%,A%,B%,C%,D% 
  903.  "OS_CRC",0,Save_Area%,Save_Area%+(write_ptr%!24),1 
  904.  newcrc%
  905.  "OS_File",0,dest$+name$,write_ptr%!16,write_ptr%!20,Save_Area%,Save_Area%+(write_ptr%!24)
  906.  &68737542 
  907.  "OS_CRC",0,start%,start%+write_ptr%!24,1 
  908.  newcrc%
  909.  "OS_File",0,dest$+name$,write_ptr%!16,write_ptr%!20,start%,start%+write_ptr%!24
  910.  0,"Flat file not understood at EXT#&"+
  911. ~write_ptr%
  912. crc%=write_ptr%!12
  913.  crc%<>newcrc% 
  914.  0,"Crc Failure at "+name$
  915. 6Percentage%=100*thruput% 
  916.  MaxThruPut%:
  917. update_bar
  918. write_ptr%+=write_ptr%!4
  919.  write_ptr%>=upto%
  920.  channel%=
  921. SaveUserName(dest$)
  922.  (ToFloppy% 
  923.  FloppySize%<BigFloppy%) 
  924. update_module("GDraw", dest$+"RMStore.",dest$+"^.!AWViewer.RMStore.")
  925. update_module("DitherExt", dest$+"RMStore.",dest$+"^.!AWViewer.RMStore.")
  926. update_module("FontDraw",dest$+"RMStore.",dest$+"^.!AWViewer.RMStore.")
  927. update_module("ImageExtnd",dest$+"RMStore.",dest$+"^.!AWViewer.RMStore.")
  928.  ToFloppy% 
  929.  "XOS_CLI","Remove "+dest$+"Auto.Block"
  930.  "XOS_CLI","Remove "+dest$+"Auto.BlkSprts"
  931. Swapping%=
  932. flicker(Disc2_Page%,Disc2$)
  933. Swapping%=
  934. _FileSize(System$)=
  935. buffer%=Work_Area%
  936.  "OS_FSControl",26,System2$,System$,%000110000100010
  937.  "OS_FSControl",26,System2$+".!*",System$+".*",%000000000100010
  938. approach_the_bar
  939.  "XOS_CLI","CDIR "+System$+".Modules"
  940.  "XOS_CLI","CDIR "+System$+".!CCShared"
  941.  "XOS_CLI","CDIR "+System$+".!CCShared.RMStore"
  942. update_module("GDraw", dest$+"RMStore.",System$+".!CCShared.RMStore.")
  943. update_module("DitherExt", dest$+"RMStore.",System$+".!CCShared.RMStore.")
  944. update_module("FontDraw",dest$+"RMStore.",System$+".!CCShared.RMStore.")
  945. update_module("ImageExtnd",dest$+"RMStore.",System$+".!CCShared.RMStore.")
  946. update_module("CCSquash",dest$+"RMStore.",System$+".!CCShared.RMStore.")
  947. update_module("SpriteExt",dest$+"RMStore.",System$+".!CCShared.RMStore.")
  948. update_shared("!TransTIFF","Filters",System2$+".!CCShared.",1.06)
  949. update_module("ABIMod",dest$+"RMStore.",System$+".Modules.")
  950. update_module("Colours",dest$+"RMStore.",System$+".Modules.")
  951. approach_the_bar
  952.  "XOS_Byte",229,1
  953. _FileSize(f$)
  954.  type%,size%
  955.  "OS_File",17,f$ 
  956.  type%,,,,size%
  957.  type%=0 
  958. size%=
  959. =size%
  960. approach_the_bar
  961. 12Percentage%+=(100-Percentage%) 
  962. update_bar
  963. update_module(name$,from$,to$)
  964. version(from$+name$) > 
  965. version(to$+name$) 
  966.  "XOS_File",16,from$+name$,buffer% 
  967.  ,,load%,exec%,size%
  968. report(name$+" "+
  969. version(from$+name$))
  970. report(name$+" "+
  971. version(to$+name$))
  972.  "XOS_File",0,to$+name$,load%,exec%,buffer%,buffer%+size%
  973. approach_the_bar
  974. update_shared(name$,chunk$,from$,version)
  975.  version > 
  976. sharedversion(name$,chunk$) 
  977. updatesharedinfo(name$,chunk$,version) 
  978.  "XOS_FSControl",26,from$+name$,System$+".!CCShared."+name$,%000000000100011 
  979.  ;flags%
  980. approach_the_bar
  981. sharedversion(name$,chunk$)
  982.  version,line$,token$,t2$,t3$
  983. version=0
  984. G*channel%=
  985. (System$+".!CCShared.!Boot")
  986.  channel% 
  987. #channel% 
  988.  version=0
  989. line$=
  990. getline(channel%,0)
  991. token$=
  992. gettoken(line$)
  993.  token$ 
  994.  "|-chunk"
  995. N&version=
  996. readversion(name$,chunk$)
  997. #channel%
  998. channel%=
  999. =version
  1000. readversion(name$,chunk$)
  1001.  version:version=0
  1002. token$=
  1003. gettoken(line$)
  1004. gettoken(line$)
  1005.  token$="CC," 
  1006.  t2$=chunk$ 
  1007. line$=
  1008. getline(channel%,0)
  1009. token$=
  1010. gettoken(line$)
  1011. gettoken(line$)
  1012. gettoken(line$)
  1013.  token$="|-entry" 
  1014.  t2$=
  1015. sanspling(name$) 
  1016.  t3$="-version" 
  1017. version=
  1018. gettoken(line$))
  1019. =version
  1020. updatesharedinfo(name$,chunk$,version)
  1021.  ok%,copy%,linecopy$,linecopy2$
  1022. e    ok%=
  1023.  "XOS_File",5,System$+".!CCShared.!Boot" 
  1024.  exists%;flags%
  1025.  exists%<>1 
  1026.  (flags%
  1027. ("Create "+System$+".!CCShared.!Boot")
  1028. ("Remove "+System$+".!CCShared.!BootO")
  1029. ("Rename "+System$+".!CCShared.!Boot "+System$+".!CCShared.!BootO")
  1030. l$h%=
  1031. (System$+".!CCShared.!Boot")
  1032. n+channel%=
  1033. (System$+".!CCShared.!BootO")
  1034.  channel% 
  1035. copy%=
  1036. #channel%
  1037. line$=
  1038. getline(channel%,0)
  1039. linecopy$=line$
  1040. token$=
  1041. gettoken(line$)
  1042.  token$ 
  1043.  "|-chunk"
  1044. copy%=
  1045. gettoken(line$)="CC," 
  1046. gettoken(line$)=chunk$ 
  1047. y/line$=
  1048. getline(channel%,0):linecopy2$=line$
  1049. gettoken(line$)="|-entry" 
  1050. gettoken(line$)=
  1051. sanspling(name$) 
  1052. copy%=
  1053. #h%,linecopy$
  1054. #h%,linecopy2$
  1055. #h%,linecopy$
  1056.  copy% 
  1057. #h%,linecopy$
  1058. #channel%
  1059. ("SetType "+System$+".!CCShared.!Boot Obey")
  1060. *channel%=
  1061. (System$+".!CCShared.!Boot")
  1062.  channel% 
  1063.     ok%=
  1064. #channel%=0 
  1065. #channel%,"|> <CCShared$Dir>.!Boot"
  1066. #channel%,"|"
  1067. #channel%,"|  Setup script for CCShared system."
  1068. #channel%,"|  (Created by ArtWorks Installer.)"
  1069. #channel%,"|  Do not hand edit this file!"
  1070. #channel%,"|"
  1071. #channel%,"Set CCShared$Dir <Obey$Dir>"
  1072. #channel%,""
  1073. #channel%=(
  1074. #channel%)
  1075. #channel%,  ""
  1076. #channel%,  "|-chunk CC, "+chunk$
  1077. #channel%,  "|-entry "+
  1078. sanspling(name$)+" -version "+
  1079. (version)
  1080. #channel%,  "Obey <CCShared$Dir>."+name$+".!Boot"
  1081. #channel%,  ""
  1082. #channel%
  1083. channel%=
  1084. sanspling(s$)
  1085. s$,1)="!" 
  1086. s$,2)
  1087. mkdir(new$,
  1088.  old$)
  1089. new$,".")=0 
  1090. old$="":=new$
  1091.  old$<>"" 
  1092. new$,
  1093. (old$))=old$ 
  1094. old$=
  1095. filepath(new$)
  1096.  dot%
  1097. dot%=2
  1098. new$,dot%),".")
  1099. new$,dot%,1)="." 
  1100. old$=
  1101. new$,dot%-1):
  1102.  "XOS_CLI","CDIR "+dest$+old$
  1103. dot%+=1
  1104.     =new$
  1105. grab_memory(wanted%)
  1106.  "Wimp_SlotSize",-1,-1 
  1107.  slot_size%,next_slot%,free%
  1108.  wanted%<>0 
  1109.  "OS_ReadMemMapInfo" 
  1110.  page_size%
  1111. Hwanted%=page_size%*((page_size%+
  1112. (wanted%)-1)
  1113. page_size%)*
  1114. (wanted%)
  1115.  "OS_ReadDynamicArea",5 
  1116.  ,ramsize%
  1117. newslot%=free%-page_size%
  1118.  newslot%>=wanted% 
  1119. report("Available: "+
  1120. (free%
  1121. 1024)+"K Claimable: "+
  1122. (newslot%
  1123. 1024)+"K Requested: "+
  1124. (wanted%
  1125. 1024)+"K Already got: "+
  1126. (slot_size%
  1127. 1024)+"K")
  1128.  newslot%>=wanted% 
  1129. newslot%=wanted%
  1130.  "Wimp_SlotSize",slot_size%+newslot%,next_slot%
  1131.  "Wimp_SlotSize",-1,-1 
  1132.  slot_size%,next_slot%,free%
  1133. =slot_size%+&8000
  1134. claim(A%)
  1135. A%=(A%+3)
  1136. A%+=FREE%
  1137.  A%>Z% 
  1138.  0,"Insufficient funds for that memory transaction."
  1139.  A%,FREE%
  1140. bigger(A%,B%)=(A% 
  1141.  A%>B%) 
  1142.  (B% 
  1143.  B%>=A%)
  1144. version(name$)
  1145.  version$
  1146. version$=""
  1147. channel%=
  1148. (name$)
  1149.  channel%=0 
  1150.  "XOS_GBPB",3,channel%,block%,4,20 
  1151.  ;Flags%
  1152.  (Flags% 
  1153. #channel%:channel%=
  1154.  !block%<
  1155. #channel% 
  1156. #channel%=!block%
  1157.  Flags%=
  1158. #channel%:
  1159.  Flags%=9 
  1160. #channel%
  1161. #channel% 
  1162.  Flags%=
  1163. #channel%:
  1164.  Flags%<>9 
  1165. #channel%
  1166. #channel% 
  1167. version$=
  1168. Flags%
  1169.  Flags%=0 
  1170.  #channel% 
  1171. version$+=
  1172. #channel%)
  1173.  Flags%
  1174.  #channel%
  1175. channel%=
  1176. =version$
  1177. sysvar(varname$)
  1178.  "XOS_ReadVarVal",varname$,Block%,1024,,3 
  1179.  ,,N%,,T%
  1180.  T%<>0 
  1181.  N%>255 
  1182.  0,"Unable to read "+varname$+" string too long":=""
  1183. rtoz1(Block%,N%)
  1184. whatdisc
  1185.  MediaName$
  1186.  "XADFS_DescribeDisc","0",Block% 
  1187.   Error%;Flags%
  1188.  (Flags% 
  1189. MediaName$=
  1190. rtoz(Block%+22)
  1191. MediaName$," ") 
  1192. MediaName$=
  1193. MediaName$,
  1194. MediaName$," ")-1)
  1195. =MediaName$
  1196. write_prot(name$)
  1197.  "XOS_CLI","ADFS:NAMEDISC 0 "+name$ 
  1198.  Error%;Flags%
  1199.  (Flags% 
  1200.  !Error%=&108C9 
  1201. discname(name$)
  1202. name$=
  1203. name$,7)
  1204. name$,
  1205. name$,".")-1)
  1206. report(G$)
  1207.  DEBUG% 
  1208.  &0A1940 
  1209.  (f% 
  1210.  1)<>1 
  1211.  &0A1941
  1212. debug(d$)
  1213.  DEBUG% 
  1214. message(0,d$,1)
  1215. getline(h%,size%)
  1216.  line$
  1217. line$=
  1218.  size%<>0 
  1219.  "Hourglass_Percentage",((
  1220. #h%)/size%)*100
  1221. =line$
  1222. gettoken(
  1223.  input$)
  1224.  token$,c%
  1225. input$," ")
  1226.  c%<>0 
  1227. token$=
  1228. input$,c%-1)
  1229.     )input$=
  1230. input$,
  1231. (input$)-
  1232. (token$)-1)
  1233. input$,1)=" "
  1234. input$=
  1235. input$,
  1236. (input$)-1)
  1237. token$=input$
  1238. input$=""
  1239. =token$
  1240. getsystempath
  1241.  sys$,path%,cc%
  1242. sys$=
  1243. sysvar("System$Path")
  1244. sys$)=" "
  1245. sys$=
  1246. sys$)
  1247. sys$,",") 
  1248. sysvar("System$Dir")
  1249. sys$)=":" 
  1250. sysvar("System$Dir")
  1251. filepath(
  1252. sysvar("System$Path"))
  1253. setsources
  1254.  mydir$:mydir$=
  1255. sysvar("Installer$Dir")
  1256. upper(
  1257. mydir$,2))="CD" 
  1258. FromCD%=
  1259. #Disc2$=mydir$+".^.Floppy.Disc2"
  1260. FromCD%=
  1261. ""Disc2$="ADFS::"+package$+"2.$"
  1262. System2$=Disc2$+".!System"
  1263.